<template>
  <div>
    <el-button @click="closeDrawer()" size="small" type="primary">导入模板下载</el-button>
    <div style="margin:20px 0"></div>
    <importFile
      :title="'导入'"
      :actionUrl="urls"
      @close="closeHandler"
    />

    <div style="height:47px;"></div>
  </div>
</template>
<script>
import {downloadUrl} from '@/utils'
import { exportTemplateToB } from '@/api/omSale/salesPlan/MonthTargetQuery';
import { exportExcelFile2 } from '@/utils';
import moment from 'moment'
export default {
  data(){
    return{
      urls:'/api/cmscloud.wholesales/ttVsMonthTarget/importTtVsMonthTargetToB',
      fetchParams:{
      },
      fetchApi:()=>{},
    }
  },
  methods:{
    closeDrawer(type){
      this.$confirm('是否将Excel表格保存至本地文件夹?', '提示', {
          confirmButtonText: '下载',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.exportLoading = true;
        exportTemplateToB()
            .then(response => {
              exportExcelFile2(response.data, 'B端月度指标导入模板');
              this.exportLoading = false;
            })
            .catch(err => {
              console.log(err);
            });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });
        });
    },
    closeHandler(val){
      this.$emit('close')
    },
  },
}

</script>
